
#include "Library.h"

void ENTITY::AddExperience(int amount)
{
	SetExperience(experience + amount);
}

void ENTITY::AddGold(int amount)
{
	SetGold(gold + amount);
}

void ENTITY::AddHealth(int amount)
{
	SetHealth(health + amount);
}

void ENTITY::AddMana(int amount)
{
	SetMana(mana + amount);
}

int ENTITY::GetExperience()
{
	return experience;
}

int ENTITY::GetGold()
{
	return gold;
}

int ENTITY::GetHealth()
{
	return health;
}

int ENTITY::GetMana()
{
	return mana;
}

int ENTITY::GetMaxHealth()
{
	return maxhealth;
}

int ENTITY::GetMaxMana()
{
	return maxmana;
}

char* ENTITY::GetName()
{
	return name;
}

void ENTITY::SetExperience(int newexperience)
{
	experience = newexperience;
}

void ENTITY::SetGold(int newgold)
{
	gold = newgold;
}

void ENTITY::SetHealth(int newhealth)
{
	health = newhealth;

	if (health > maxhealth)
		health = maxhealth;

	if (health < 0)
		health = 0;
}

void ENTITY::SetMana(int newmana)
{
	mana = newmana;

	if (mana > maxmana)
		mana = maxmana;

	if (mana < 0)
		mana = 0;
}

void ENTITY::SetMaxHealth(int newmaxhealth)
{
	maxhealth = newmaxhealth;
}

void ENTITY::SetMaxMana(int newmaxmana)
{
	maxmana = newmaxmana;
}

bool ENTITY::SetName(char *newname)
{
	if (strlen(newname) == 0)
		return false;

	if (strlen(newname) > 32)
		return false;

	strcpy(name,newname);

	return true;
}
void ENTITY::LoseHealth(int amount)
{
	SetHealth(health - amount);
}

void ENTITY::LoseMana(int amount)
{
	SetMana(mana - amount);
}

void ENTITY::SpendGold(int amount)
{
	SetGold(gold - amount);
}

void ENTITY::SetPoisoned(bool value)
{
	poisoned = value;
}

bool ENTITY::IsPoisoned()
{
	return poisoned;
}

void ENTITY::SetMonster(bool value)
{
	ismonster = value;
}

bool ENTITY::IsMonster()
{
	return ismonster;
}